package com.ellricky.newtv.adapter

import android.widget.RelativeLayout
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.ellricky.newtv.R
import com.ellricky.baselib.entity.newtv.ClassInfo

class ClassAdapter : BaseQuickAdapter<ClassInfo, BaseViewHolder>(R.layout.item_class) {

    override fun convert(holder: BaseViewHolder, item: ClassInfo) {
        holder.getView<RelativeLayout>(R.id.cl_class).also {
            it.isSelected = item.isSelect
        }
        if (item.isDelete) {
            holder.setVisible(R.id.iv_delete, true)
        } else {
            holder.setVisible(R.id.iv_delete, false)
        }

        holder.setText(R.id.tv_class_name, item.name)
    }
}